package com.template.app.common.service.parser;

import com.template.app.common.bean.UploadResult;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.util.List;

@Component
public class PdfParser extends MaterialParser{

	@Override
	public String getFileSize(String fileName, byte[] content, long fileLength)
			throws Exception {
		if(fileLength>MAX_PDF){
			throw new Exception("PDF文件大小不能超过"+MAX_IMG/1024+"K");
		}
		return getPdfSize(fileName,content);
	}

	private String getPdfSize(String fileName, byte[] content) {
		//TODO
		return "PDF fileSize";
	}

	@Override
	public void addToResultList(String originalFileName,
			String parentFileName, byte[] content, long fileLength,
			List<UploadResult> resultList) throws IOException {
		resultList.add(super.wrapMaterialResult(originalFileName, parentFileName, content, fileLength));
	}




}
